package com.binhai.user;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;
    //查询所有用户
    @RequestMapping("/getAllInfos.do")
    public List getAllInfos() {
        return userService.getAllInfos();
    }
    //添加用户信息
    @RequestMapping( "/addInfo.do")
    public Map addInfo(@RequestBody UserBean bean) {
        return userService.addInfo(bean);
    }
    //删除用户信息
    @RequestMapping("/deleteInfo.do")
    public Map deleteInfo(@RequestBody UserBean bean) {
        int id = bean.getId();
        return userService.deleteInfo(id);
    }
    //修改用户信息
   @RequestMapping("/modifyInfo.do")
    public Map modifyInfo(@RequestBody UserBean bean) {
        return userService.modifyInfo(bean);
    }
    //条件查询
    @RequestMapping("/selectByWhere.do")
    public List selectByWhere(@RequestBody UserBean bean) {
        String name = bean.getName();
        return userService.selectByWhere(name);
    }
}